#include <bits/stdc++.h>
using namespace std;
int r[100005];
int main()
{
    freopen("duel.in","r",stdin);
    freopen("duel.out","w",stdout);
    int n,maxr;
    cin>>n;
    for(int i=0;i<n;i++)
    {
        int x;
        cin>>x;
        maxr=max(maxr,x);
        r[x]++;
    }
    int last1=0,last2=0;
    for(int i=1;i<=maxr;i++)
    {
        if(r[i]!=0)
        {
            if(last2>0)
            {
                if(last2>r[i])
                {
                    last1+=r[i];
                    last2-=r[i];
                }
                else
                {
                    r[i]-=last2;
                    if(r[i]>last1)
                    {
                        int p=last2;
                        last2=r[i]-last1;
                        last1+=p;
                    }
                }
            }
            else
            {
                if(r[i]>last1)
                {
                    last2=r[i]-last1;
                }
            }
        }
    }
    cout<<last1+last2<<endl;
    return 0;
}
